Skip to main content

CreateSecurityGroup

Description

call CreateSecurityGroup to create a new security group. for a new security group, only instances in the security group are allowed to access each other by default, and all communication requests outside the security group are rejected. To allow communication requests from other security group instances or access requests from the Internet, you must grant security group permissions (AuthorizeSecurityGroup).

Request Method

POST

Request Path

/apsara/route/Ecs/CreateSecurityGroup

Request Parameters Common Parameters

NameLocationTypeRequiredSample valueDescription
DescriptionBODYstringNoSecurityGroupTestDescriptionsecurity group description information. The length is 2~256 English or Chinese characters, and cannot be http:// and https:// start. default value: empty.
Tag.N.keyBODYstringNonullthe tag key of the security group. Description To improve compatibility, we recommend that you use the Tag.N.Key parameter as much as possible.
Tag.N.KeyBODYstringNoTestthe tag key of the security group. The value range of n is 1~20. Once the value is passed in, an empty string is not allowed. Supports up to 128 characters, cannot start with aliyun and acs:, cannot contain http:// or https://.
SecurityGroupNameBODYstringNoSecurityGroupTestNamesecurity group name. The length is 2~128 English or Chinese characters. Must start with a large or small letter or Chinese, and cannot be http:// and https:// start. It can contain numbers, colons (:), underscores (_), or dashes (-). Default value: empty.
ResourceGroupIdBODYstringNorg-bp67acfmxazb4p****the ID of the enterprise resource group where the security group is located.
SecurityGroupTypeBODYstringNoenterprisesecurity group type, divided into normal security group and enterprise security group. Value range: normal: normal security group. enterprise: enterprise security group.
versionBODYstringNo2016-01-01version of api
Tag.N.valueBODYstringNonullthe tag value of the security group. description to improve compatibility, it is recommended that you try to use the Tag.N.Value parameter.
VpcIdBODYstringNovpc-bp1opxu1zkhn00gzv****VPC ID to which the security group belongs.
regionIdBODYstringYesNo sample value for this parameter.region id
Tag.N.ValueBODYstringNoTestthe tag value of the security group. The value range of n is 1~20. Once the value is passed in, an empty string is allowed. Supports up to 128 characters, cannot start with acs:, cannot contain http:// or https://.
RegionIdBODYstringYescn-qingdao-env17-d01the region ID of the security group. You can call the DescribeRegions to view the latest Alibaba Cloud region list.
ClientTokenBODYstringNo123e4567-e89b-12d3-a456-426655440000Ensure request idempotence. Generate a parameter value from your client to ensure that the parameter value is unique between different requests. ClientToken only supports ASCII characters and cannot exceed 64 characters. For more details, please refer to the section on how to ensure idempotence in the cloud server ECS development guide.

Return data

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}